<template><el-container>
	<el-header class="header">
		<Header />
	</el-header>
	<el-container>
		<el-aside width="200px">
			<navigator></navigator>
		</el-aside>
		<el-main style="padding-top: 50px">
			<el-row>
				<el-col :span="12" :offset="6">
					<el-row> 账户类型：{{ orgType == 1 ? '公司' : '银行' }} </el-row>
					<el-row style="padding-top: 10px"> 账户地址：{{ address }} </el-row>
					<el-row>
						<el-button type="primary" @click="detail">详情</el-button>
					</el-row>
				</el-col>
			</el-row>
			<!-- 详情 -->
			<el-row v-if="dialogVisible">
				<el-dialog :title="orgType == 1 ? '公司详情' : '银行详情'" :visible.sync="dialogVisible" width="30%">
					<el-descriptions direction="vertical" :column="4" border>
						<el-descriptions-item label="用户地址">{{ info.address }}</el-descriptions-item>
						<el-descriptions-item label="用户名">{{ info.name }}</el-descriptions-item>
						<el-descriptions-item label="用户资产">{{ info.creditAsset }}</el-descriptions-item>
					</el-descriptions>
				</el-dialog>
			</el-row>
		</el-main>
	</el-container>
</el-container></template>

<script>
import Navigator from '@/components/Navigator'
import Header from '@/components/Header'

export default {
	name: 'Individual',
	data() {
		return {
			dialogVisible: false,
			orgType: 1,
			address: '',
			info: {},
		}
	},
	components: {
		Navigator,
		Header,
	},
	methods: {
		logout() {
			this.$router.push('/login')
		},
		detail() {
			let requestPath = this.orgType == 1 ? 'getCompanyEntity' : 'getBankEntity'
			this.$axios.get(`/finance/query/${requestPath}?address=${this.address}&queryAddress=${this.address}`).then((res) => {
				if (res.code == 200) {
					this.info = res.data.userVO
					this.dialogVisible = true
				}
			})
		},
	},
	mounted() {
		this.orgType = this.$cookies.get('orgType')
		this.address = this.$cookies.get('address')
	},
}
</script>

<style scoped>
.header {
	background-color: #409eff;
	color: #fff;
	line-height: 20px;
}

.content {
	font-size: 16px;
}
</style>
